package org.uk.splitsbrowser.client.presenter;

import java.util.List;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

import org.uk.splitsbrowser.shared.OEvent;
import org.uk.splitsbrowser.shared.SplitsbrowserException;


/**
 * The client side stub Event Service
 */
@RemoteServiceRelativePath("oevent")
public interface OEventService extends RemoteService {
	
	public enum ResultsImportFormat{ IOFXML, SPLITSBROWSER_CSV, SPORTIDENT_CSV, SPORTIDENT_HTML }; 

	/** Create new event object in the database */ 
	String newEvent(OEvent event) throws SplitsbrowserException;
	
	/** Save updates to the event information does not include updating results or map data 
	 * @throws SplitsbrowserException */ 
	void saveEvent(OEvent event) throws SplitsbrowserException;
	
	/** Delete event in the database including any associated results, maps and  splits data */ 
	void deleteEvent(String id) throws SplitsbrowserException;;
	
	/** Query for a match of any word in query string to any event field in the database */ 
	List<OEvent> queryEvent(String queryString, int offset, int count);

	/** Get Event object for a given */ 
	OEvent getEvent(String eventId);
	
	/** Upload results for an event in a specified format */ 
	void uploadResults(OEvent event, ResultsImportFormat format, String filename);
	
	/** Upload a map information */
	void uploadMap(OEvent event, String filename);
	
	/** Upload coarse metadata */
	void uploadCourses(OEvent event, String filename);

}
